package com.dingyx.ps.model.vo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * <用户信息对象，包含权限信息>
 * @author ZhangYang
 * @date 2021/6/4 10:07
 * @version 1.0.0
 */
@Data
@ApiModel("用户信息对象，包含权限信息")
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class BossUserVO implements Serializable {
    @ApiModelProperty(value = "企业用户表id")
    @TableId(type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty(value = "基础用户id")
    private Integer baseUserId;

    @ApiModelProperty(value = "用户名称")
    private String userName;

    @ApiModelProperty(value = "租户id")
    private Integer tenantId;

    @ApiModelProperty(value = "租户名称")
    private String tenantName;

    @ApiModelProperty(value = "企业状态：0正常；1关闭（不能登录）；2冻结（可登录处理业务，不能产生新业务）")
    private Integer tenantStatus;

    @ApiModelProperty(value = "身份（0员工；1企业管理员；2平台操作员）")
    private Integer identityType;

    @ApiModelProperty(value = "电话")
    private String phone;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "最后登录时间")
    private LocalDateTime lastLoginDate;

    @ApiModelProperty(value = "最后登录ip")
    private String lastLoginIp;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "最后修改密码时间")
    private LocalDateTime lastModifyPwdDate;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "账号有效截止时间")
    private LocalDateTime deadTime;

    @ApiModelProperty(value = "是否在职：0-离职；1-在职")
    private Integer hiredYn;

    @ApiModelProperty(value = "状态：0正常；1关闭（不能登录）；2冻结（可登录处理业务，不能产生新业务）")
    private Integer status;

    @ApiModelProperty(value = "小微企业标识（0否；1是）")
    private Integer isSmall;

    @ApiModelProperty(value = "拥有的权限(一层集合)")
    private List<BossApplicationMenuVO> menus = new ArrayList<>();

    @ApiModelProperty(value = "拥有的权限(带层级关系的多层集合)")
    private List<BossApplicationMenuVO> stratumMenus = new ArrayList<>();

    @ApiModelProperty(value = "拥有的权限组集合(角色)")
    private List<String> groupNames = new ArrayList<>();

    @ApiModelProperty(value = "token")
    private String token;
    @ApiModelProperty(value = "其他子系统的身份标识（yg:灵活用工）")
    private Map<String,String> tokens;

    //以下为统一登录使用属性
    @ApiModelProperty(value = "登录使用属性")
    private String tenantCode;
    @ApiModelProperty(value = "登录使用属性")
    private String ruId;
    @ApiModelProperty(value = "登录使用属性")
    private String warehouseId;
    @ApiModelProperty(value = "登录使用属性")
    private String version;
    @ApiModelProperty(value = "登录使用属性")
    private int expireMinute;
    @ApiModelProperty(value = "登录使用属性")
    private long expireFreshTime;

    //以下为工程师使用属性
    @ApiModelProperty(value = "用户对应的企业工程师资源ID")
    private Integer tenantEngineerId;
    @ApiModelProperty(value = "工程师名称")
    private String engineerName;
    @ApiModelProperty(value = "工程师编号")
    private String engineerNo;
    @ApiModelProperty(value = "工程师用户ID")
    private Integer engineerUserId;

}
